package com.ccx.library.handler.Token;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

import java.util.concurrent.TimeUnit;

/**
 * token刷新延长 (Redis)
 */
@Component
public class TokenFreshenHandler {

    @Autowired
    private RedisTemplate redisTemplate;

    @Value("${token.expire}")
    private Long time;

    public Boolean fresh(String key){
        Boolean expire = redisTemplate.expire(key, time, TimeUnit.MINUTES);
        return expire;
    }
}
